﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QYmall.Core.Model.Models
{
    /// <summary>
    /// 商户提现申请
    /// </summary>
    public class MerchantCash
    {
        /// <summary>
        /// 自增ID
        /// </summary>
        [Display(Name = "自增ID")]
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        /// <summary>
        /// 所属商户ID
        /// </summary>
        [Display(Name = "所属商户")]
        [ForeignKey("Merchant")]
        public int MerchantId { get; set; }

        /// <summary>
        /// 收款方式ID
        /// </summary>
        [Display(Name = "收款方式")]
        public int PayinfoId { get; set; }

        /// <summary>
        /// 转账类型
        /// </summary>
        [Display(Name = "转账类型")]
        [StringLength(128)]
        public string? PayType { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        [Display(Name = "姓名")]
        [StringLength(128)]
        public string? FullName { get; set; }

        /// <summary>
        /// 开户银行
        /// </summary>
        [Display(Name = "开户银行")]
        [StringLength(128)]
        public string? BankName { get; set; }

        /// <summary>
        /// 收款账号
        /// </summary>
        [Display(Name = "收款账号")]
        [StringLength(128)]
        public string? AccountNo { get; set; }

        /// <summary>
        /// 收款二维码
        /// </summary>
        [Display(Name = "收款二维码")]
        [StringLength(512)]
        public string? QRCode { get; set; }

        /// <summary>
        /// 账户余额
        /// </summary>
        [Display(Name = "账户余额")]
        [Column(TypeName = "decimal(18, 2)")]
        public decimal BalanceAmount { get; set; } = 0M;

        /// <summary>
        /// 提现金额
        /// </summary>
        [Display(Name = "提现金额")]
        [Column(TypeName = "decimal(18, 2)")]
        public decimal TransferAmount { get; set; } = 0M;

        /// <summary>
        /// 申请备注
        /// </summary>
        [Display(Name = "申请备注")]
        [StringLength(512)]
        public string? AddRemark { get; set; }

        /// <summary>
        /// 申请时间
        /// </summary>
        [Display(Name = "申请时间")]
        public DateTime AddTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 处理状态
        /// 1.待审核
        /// 2.已审核
        /// 3.已完成
        /// 4.不通过
        /// </summary>
        [Display(Name = "处理状态")]
        public byte HandleStatus { get; set; } = 1;

        /// <summary>
        /// 处理人
        /// </summary>
        [Display(Name = "处理人")]
        [StringLength(128)]
        public string? HandleBy { get; set; }

        /// <summary>
        /// 处理时间
        /// </summary>
        [Display(Name = "处理时间")]
        public DateTime? HandleTime { get; set; }

        /// <summary>
        /// 审核意见
        /// </summary>
        [Display(Name = "审核意见")]
        [StringLength(512)]
        public string? HandleRemark { get; set; }

        /// <summary>
        /// 转账凭证
        /// </summary>
        [Display(Name = "转账凭证")]
        [StringLength(512)]
        public string? PayImgUrl { get; set; }

        /// <summary>
        /// 到账时间
        /// </summary>
        [Display(Name = "到账时间")]
        public DateTime? PayTime { get; set; }

        /// <summary>
        /// 已删除：0否1是
        /// </summary>
        [Display(Name = "状态")]
        [Range(0, 9)]
        public byte IsDelete { get; set; } = 0;


        /// <summary>
        /// 商户信息
        /// </summary>
        public Merchants? Merchant { get; set; }
    }
}
